package com.woniu.cms.goods.core.controller;


import com.woniu.cms.goods.core.service.IGoodsSummaryService;
import com.woniu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;

/**
 * <p>
 * 单项工程月份材料汇总表 前端控制器
 * </p>
 *
 * @author romantic sheep
 * @since 2022-09-20
 */
@RestController
@Api(tags = "单项工程月份材料汇总")
@RequestMapping("/goods-summary")
public class GoodsSummaryController {

    @Autowired
    private IGoodsSummaryService summaryService;

    /*
    * 单项工程月份材料汇总表
    * @constructTeam，施工队伍
    * @date，前端传过来的需统计的月份，格式为yyyy-MM
    * @materialType，材料供应类型（0-甲供，1-乙供）
    * */
    @ApiOperation("统计汇总，单项工程月份材料汇总")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "constructTeam",value = "施工队伍"),
            @ApiImplicitParam(name = "date",value = "前端传过来的需统计的月份，格式为yyyy-MM"),
            @ApiImplicitParam(name = "materialType",value = "材料供应类型（0-甲供，1-乙供）")
    })
    @GetMapping("count")
    public Result countSummary(String constructTeam,String date,Integer materialType){
        Result result = null;
        try {
            result = summaryService.countSummary(constructTeam,date,materialType);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
        return result;
    }
}

